fix(ux): drill-down feature parity with main tabs#980
Open
cpcloud wants to merge 4 commits intomicasa-dev:mainfrom
Open
fix(ux): drill-down feature parity with main tabs#980cpcloud wants to merge 4 commits intomicasa-dev:mainfrom
cpcloud wants to merge 4 commits intomicasa-dev:mainfrom
Conversation
Shift+A (magic-add) dispatch checked tab.Kind == tabDocuments, but drill-down tabs inherit the parent tab's Kind (e.g. tabAppliances for Appliances > Documents), so the keypress fell through silently. The "Press o to open" hint had the same anti-pattern. Route both through Tab.isDocumentTab(), which already consults the handler's FormKind() and covers both top-level and entity-scoped document tabs. When invoked inside a drill-down, the quick form is pre-populated with the parent entity so the created document is correctly attached, and acceptDeferredExtraction no longer lets the LLM override a user-chosen scope. Reproduction 1. Open a house with at least one Appliance and one document. 2. Navigate to Appliances, enter, and drill into Documents for any appliance. 3. Press i to enter edit mode, then Shift+A. 4. Before: nothing happens. After: the quick-add form opens, pre-scoped to the appliance.
Drill-down tabs inherit the parent's Kind rather than the semantic entity Kind. Checks like tab.Kind == tabDocuments silently break parity; go through Tab.isDocumentTab() or the handler's FormKind() instead. Refresh the verified date.
promptHardDelete and the confirm-prompt dispatch keyed on tab.Kind, so Shift+D did nothing in the Appliances > Maintenance drill-down (whose Kind is tabAppliances, inherited from the parent). The same bug affected the "Permanently delete this item/incident?" label and the soft-delete status messages. Route all entity-semantic checks through handlerFormKind(tab), a new helper that reads tab.Handler.FormKind() and maps cleanly onto formIncident, formMaintenance, etc. This keeps drill-downs functionally identical to their parent tabs. toggleSettledFilter gets the same treatment: drop the blanket m.inDetail() early-return and gate on FormKind == formProject via m.effectiveTab() so any future project-scoped drill-down inherits the filter automatically. Reproduction 1. Open a house with at least one appliance. 2. Add a maintenance item scoped to that appliance. 3. Drill into Appliances > Maintenance, press i, then d to soft-delete, then Shift+D and y. 4. Before: prompt said "incident", and Yes hard-deleted an incident (no-op because no IDs matched), leaving the maintenance item intact. After: prompt says "item", and Yes permanently deletes the item.
Pressing "a" in Appliance > Maintenance, Project > Quotes, and Vendor > Quotes used to open the generic add form and default the parent field to whichever row happened to sort first in its list. Users had to re-select the entity they just drilled into. Carry the drill-down context into the add form via a scoped startAddFn on each handler, backed by new startMaintenanceFormScoped and startQuoteFormScoped helpers that pre-populate the known parent when called with a non-empty ID/name. Reproduction 1. Create two appliances, Decoy and Parent. 2. Drill into Parent > Maintenance. 3. Press i, then a. 4. Before: form's Appliance select defaults to Decoy. After: it defaults to Parent.
df8e8d1 to
f43be28
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FormKindinstead of the drill-down-pollutedtab.Kind.FormKind, so behavior follows the entity rather than the parent tab kind.ain Appliance > Maintenance, Project > Quotes, and Vendor > Quotes now pre-populates the parent entity on the add form instead of defaulting to whichever row happens to sort first..claude/codebase/patterns.mdso future checks reach forFormKind()/Tab.isDocumentTab()instead oftab.Kind == tabX.